<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<script type="text/javascript" src="${basePath}js/My97DatePicker/WdatePicker.js"></script>
<#include "/views/ftl/base/manager_include.ftl">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>销售单商品列表</title>
<style>
A{color: #333;}
</style>
<script type="text/javascript">
$(function(){
	$("#search_button").click(function(){
		$('#select_form').submit();
    });
});
</script>
</head>
<body style="background:#eef3f7;">
<#include "/views/ftl/base/head.ftl">
<div class="Main">
  <div class="dw">
<#include "/views/ftl/base/menu.ftl">
<#function a><#return "销售单统计_List"></#function> 
<!--右边内容-->
<div class="Rightbox fl">
    <!--导航-->
    <div class="Bread_crbs clear">
      <div class="Bread_crbs_img fl"></div>
      <div class="Bread_crbs_text fl">
      	<a href="javascript:void(0);"><span>销售单统计</span></a>
      	<span class="fnt_famy">></span>
      	<a href="javascript:void(0);"><span>销售单商品列表</span></a>
      </div>
    </div>
    	
      <!--搜索框-->
        <form action="${basePath}manager/PurchaseSaleOrder_saleOrderStatisticsProductListAjax" id="select_form"  method="POST"> 
         	
         	<div class="input_name">
        		<span class=" searchTitle">条码&nbsp;&nbsp;:</span> 
          		<input class="search_text" type="text" name="barCode" placeholder="请输入关键字 " value="${(requestVo.barCode)!''}"/>
          		<span class=" searchTitle">货品号&nbsp;&nbsp;:</span> 
          		<input class="search_text" type="text" name="goodsNumber" placeholder="请输入关键字 " value="${(requestVo.goodsNumber)!''}"/>
          		<#--<span class=" searchTitle">销单号&nbsp;&nbsp;:</span> 
          		<input class="search_text" type="text" name="outOrderNumber" placeholder="请输入关键字 " value="${(requestVo.outOrderNumber)!''}"/>-->
          		<a href="javascript:clearbarCodeAndGoodsNumber();"   class="search_btn" style="    background: #FF0000; display: inline-block;"><span style="color:white;">清空</span></a>
            </div> 
        
         <div class="input_name">
        	<#--<span class=" searchTitle">品牌名:</span> 
          	<input class="search_text" type="text" name="brandName" placeholder="请输入关键字 " value="${(requestVo.brandName)!''}"/>-->
          	
          	<span class="searchTitle" style="font-size: 14px;color: #333333;width:60px;">销售状态:</span>
           <select name="productSaleStatus" style="font-size: 14px;color: #333333;" >  
           <option value="">----</option>
            <#list purchaseSaleOrderProductStatusTypeEnum as enum > 
            <#if requestVo.productSaleStatus?? >
	             <#if enum.type == requestVo.productSaleStatus>
	              	<option value="${enum.type}" selected="selected">${enum.typeName}</option>
	             <#else>
	             	<option value="${enum.type}">${enum.typeName}</option>
	             </#if> 
             <#else>
           	 	 <option value="${enum.type}">${enum.typeName}</option> 
             </#if>
            </#list>
			</select>
			
			<span class="searchTitle" style="font-size: 14px;color: #333333;width:60px;">大分类&nbsp;&nbsp;:</span>
           <select name="firstGoodsCategoryId" style="font-size: 14px;color: #333333;" id="first_goods_category_list_select"> 
           <option value="">----</option>
			</select>
			
			<span class="searchTitle" style="font-size: 14px;color: #333333;width:60px;">小分类&nbsp;&nbsp;:</span>
           <select name="secondGoodsCategoryId" style="font-size: 14px;color: #333333;" id="second_goods_category_list_select"> 
           <option value="">----</option>
			</select>
			
			 </div> 
			
			 <div class="input_name">
			
          	
          	
          	<span style="width:60px;">开始时间:</span>
            <input type="name" name="startTime" readonly="readonly"  id="startTime" value="${(requestVo.startTime)!''}"  onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" type="text">
    		<span style="width:60px;">结束时间:</span>
    		<input name="endTime" readonly="readonly"  value="${(requestVo.endTime)!''}" id="endTime"  onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" type="text">
            <span class="searchTitle" style="font-size: 14px;color: #333333;width:60px;">销售员:</span>
            <select name="shopClerkId" style="font-size: 14px;color: #333333;" id="shopClerkId_list" >
                
                 
			</select>
			
            </div> 
            
             <div class="input_name">
             <span class="searchTitle" style="font-size: 14px;color: #333333;width:60px;">统&nbsp;&nbsp计&nbsp;&nbsp;:</span>
           <select name="statisticsType" style="font-size: 14px;color: #333333;" id="first_goods_category_list_select"> 
           	<option value="">----</option>
           	 <option value="1" <#if requestVo.statisticsType??><#if requestVo.statisticsType ==1>selected="selected"</#if></#if> >产品</option><!--  规格一致 -->
           	 <option value="2" <#if requestVo.statisticsType??><#if requestVo.statisticsType ==2>selected="selected"</#if></#if>>货品</option>
           	 <option value="3" <#if requestVo.statisticsType??><#if requestVo.statisticsType ==3>selected="selected"</#if></#if>>营业员</option>
           	  <option value="4" <#if requestVo.statisticsType??><#if requestVo.statisticsType ==4>selected="selected"</#if></#if>>颜色</option>
           	 <option value="5" <#if requestVo.statisticsType??><#if requestVo.statisticsType ==5>selected="selected"</#if></#if>>尺码</option>
			</select>
			
			<span class="searchTitle" style="font-size: 14px;color: #333333;width:60px;">排序原因:</span>
           <select name="byOrderType" style="font-size: 14px;color: #333333;" id="first_goods_category_list_select"> 
           	<option value="">----</option>
            <option value="2"  <#if requestVo.byOrderType??><#if requestVo.byOrderType ==2>selected="selected"</#if></#if>>总销量</option>
           	 <option value="3" <#if requestVo.byOrderType??><#if requestVo.byOrderType ==3>selected="selected"</#if></#if>>总营业额</option>
			</select>
			
			<span class="searchTitle" style="font-size: 14px;color: #333333;width:60px;">排序方式:</span>
           <select name="byOrderSortType" style="font-size: 14px;color: #333333;" id="first_goods_category_list_select"> 
           	<option value="">----</option>
            <option value="1"  <#if requestVo.byOrderSortType??><#if requestVo.byOrderSortType ==1>selected="selected"</#if></#if>>从低到高</option>
           	 <option value="2" <#if requestVo.byOrderSortType??><#if requestVo.byOrderSortType ==2>selected="selected"</#if></#if>>从高到低</option>
			</select>
             
              
             
             <a href="javascript:void(0);" id="search_button" class="search_btn" style="  display: inline-block;"><span style="color:white;">搜索</span></a>



              </div> 
            
            <#-- <a href="javascript:void(0);" id="search_button" class="search_btn fl" align="center" style="  display: inline-block;"><span >搜索</span></a>  -->
        </form>


<div style="display:none;">

  <form id="h2_form" action="${basePath}manager/PurchaseSaleOrder_saleOrderProductListPage" id="select_form"  method="POST"> 
   <input id="h2_startTime" type="name" name="startTime" readonly="readonly"    value="${(requestVo.startTime)!''}"  onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" type="text">
   <input id="h2_endTime"  name="endTime" readonly="readonly"  value="${(requestVo.endTime)!''}"    onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" type="text">
  
  
  
   <input  id="h2_productSaleStatus" class="search_text" type="text" name="productSaleStatus" placeholder="请输入关键字 " value="${(requestVo.productSaleStatus)!''}"/> 
   <input  id="h2_firstGoodsCategoryId" class="search_text" type="text" name="firstGoodsCategoryId" placeholder="请输入关键字 " value="${(requestVo.firstGoodsCategoryId)!''}"/>
   <input  id="h2_secondGoodsCategoryId" class="search_text" type="text" name="secondGoodsCategoryId" placeholder="请输入关键字 " value="${((requestVo.secondGoodsCategoryId?c)!'')}"/>

 
   <input  id="h2_barCode" class="search_text" type="text" name="barCode" placeholder="请输入关键字 " value="${(requestVo.barCode)!''}"/> 
   <input  id="h2_goodsNumber" class="search_text" type="text" name="goodsNumber" placeholder="请输入关键字 " value="${(requestVo.goodsNumber)!''}"/>
   <input  id="h2_shopClerkId" class="search_text" type="text" name="shopClerkId" placeholder="请输入关键字 " value="${((requestVo.shopClerkId?c)!'')}"/>
    

  
  </form>
 
</div>


       <!-- brandId,goodsNumber,goodsName,goodsCategoryId,totalStockCount,applySex,tagPrice,retailPrice,season,unit,-->
        <div class="clear"></div>
        <!--表格列表-->
        
         <div class="Table" style="width:1200px;">
          <table id="table" cellpadding="0" cellspacing="1">
            <tbody>
              <tr  > 
              	 <td style="    width: 80px;"> </td> 
              <#list sizeList as x>
              	 <td style="     width: 80px; background: #fe6d7f;">${x}</td> 
              </#list> 
              </tr>
              <#list colorList as y>
               <tr > 
              	 <td style="    background: #fe6d7f;">${y}</td>
               	 <#list pagerTable as i>
               	 
               	 	<#if i_index == y_index>
               	 		<#list i as j> 
               	 		<#if j_index<sizeList?size>
               	 		 <td  >${(j)!''}</td> 
               	 		 </#if>
               	 		</#list>
               	 	</#if>
               	  
               	 </#list> 
               </tr>
              </#list> 
              </tboby>
           </table>
             </div>
        
        <div class="Table" style="width:1200px;display:none;">
          <table id="table" cellpadding="0" cellspacing="1">
            <tbody>
              <tr id="gl"> 
             
               
              <#if requestVo.statisticsType??>
              <#if requestVo.statisticsType ==1>  
               
              
              <td>条码</td>
              <td>货品号</td>
              <td>货品名</td>
              <td>颜色</td> 
              <td>尺码</td>
              
               <td>销售价</td> 
             
              <td>大分类</td>
              <td>小分类</td>
               <td>总销量</td>
               <td>总营业额</td> 
               <td>操作</td>
               <#elseif requestVo.statisticsType ==2>  
              <td>货品号</td>
              <td>货品名</td> 
               <td>销售价</td>  
              
             
              <td>大分类</td>
              <td>小分类</td>
               <td>总销量</td>
               <td>总营业额</td> 
               <td>操作</td>
              <#elseif requestVo.statisticsType ==3>
               <td>销售员</td> 
               <td>总销量</td>
               <td>总营业额</td>
                <#-- <td>操作</td>-->
              </#if>
               
              </#if>
             
           <#--   <td>销单状态</td>
             <td>销单号</td>
              <td>销售时间</td> 
              <td>销售员</td>
              
              <td>销售价</td> 
            <td>总量</td>
              <td>总价</td> 
    		  <td>折扣</td>
              <td>折扣价</td>  
   			 <td>结算价</td>
              <td>实际总价</td> 
              
              
              
              <td>条码</td>
              <td>货品号</td>
              <td>货品名</td>
              <td>颜色</td> 
              <td>尺码</td>
             
              <td>大分类</td>
              <td>小分类</td>
               <td>总销量</td>
               <td>总营业额</td>
              <td>操作</td> -->
              
              </tr>
            <#if (pager.list??)> 
           <#if ((pager.list?size)>0)>
           <#list pager.list as product>
     		<tr>  
     		
     		<#if requestVo.statisticsType??>
              <#if requestVo.statisticsType ==1>  
               
              
              <td><a href="javascript:click_barCode('${(product.barCode)!''}');">${(product.barCode)!''}</a></td>
              <td><a href="javascript:click_goodsNumber('${(product.goodsNumber)!''}');">${(product.goodsNumber)!''}</a></td> 
               <td>${(product.goodsName)!''}</td> 
               <td>${(product.colorSpecificationValue)!''}</td>
             <td>${(product.sizeSpecificationValue)!''}</td>  
              
               <td>${(product.retailPrice)!''}</td> 
             <td>${(product.firstGoodsCategoryName)!''}</td>
             <td>${(product.secondGoodsCategoryName)!''}</td>  
              <td>${((product.totalQuantityCount)?c)!''}</td>
               <td>${((product.realTotalPriceCount)?c)!''}</td>
              <td class="tbl_btn"> 
              <a href="javascript:click_lookgoodsNumber('${(product.goodsNumber)!''}')"><span class="review_single_model" style="    background: #00ad55;">货品统计</span></a>
                </td>
              
               <#elseif requestVo.statisticsType ==2>   
               <td><a href="javascript:click_goodsNumber('${(product.goodsNumber)!''}');">${(product.goodsNumber)!''}</a></td> 
               <td>${(product.goodsName)!''}</td> 
               <td>${(product.retailPrice)!''}</td>   
             
             <td>${(product.firstGoodsCategoryName)!''}</td>
             <td>${(product.secondGoodsCategoryName)!''}</td>  
              <td>${((product.totalQuantityCount)?c)!''}</td>
               <td>${((product.realTotalPriceCount)?c)!''}</td>
              <td class="tbl_btn"><a href="javascript:click_lookgoodsNumber('${(product.goodsNumber)!''}')"><span class="review_single_model" style="    background: #00ad55;">货品统计</span></a>  </td>
              <#elseif requestVo.statisticsType ==3>
              <td><a href="javascript:click_shopClerkId('${(product.shopClerkId)!''}');">${(product.jobNumber)!''}:${(product.clerkName)!''}</a></td>
                <td>${((product.totalQuantityCount)?c)!''}</td>
               <td>${((product.realTotalPriceCount)?c)!''}</td>
            <#--   <td class="tbl_btn"><a href="${basePath}manager/Goods_goodsInfo?goodsId=${(product.goodsId)?c}"><span class="review_single_model" style="    background: #00ad55;">查看</span></a>  </td>-->
              </#if>
              </#if>
     		
     	<#--	<td class="tbl_btn"><a href="${basePath}manager/Goods_goodsInfo?goodsId=${(product.goodsId)?c}"><span class="review_single_model" style="    background: #00ad55;">查看</span></a>  </td> -->
     	
     	<#--	<#list purchaseSaleOrderProductStatusTypeEnum as enum >  
	             <#if enum.type == product.productSaleStatus>
	              		<td>${enum.typeName}</td> 
	             </#if>  
            </#list>
     		
     		 <td>${(product.outOrderNumber)!''}</td>
     		<td>${(product.clientCreateTime)!''}</td>
     		<td>${(product.jobNumber)!''}:${(product.clerkName)!''}</td>
     		 
     		  <td>${(product.retailPrice)!''}</td>
     		
     		
     		
     	 	<td>${(product.quantity)!''}</td>
     		<td>${(product.totalPrice)!''}</td>
     		<td>${(product.discount)!''}</td>
     		<td>${(product.discountPrice)!''}</td>
     		<td>${(product.realRetailPrice)!''}</td>
     		<td>${(product.realTotalPrice)!''}</td> 
     		
     		  <td>${(product.barCode)!''}</td>
              <td>${(product.goodsNumber)!''}</td> 
               <td>${(product.goodsName)!''}</td> 
               <td>${(product.colorSpecificationValue)!''}</td>
             <td>${(product.sizeSpecificationValue)!''}</td>  
             <td>${(product.firstGoodsCategoryName)!''}</td>
             <td>${(product.secondGoodsCategoryName)!''}</td>  
              <td>${((product.totalQuantityCount)?c)!''}</td>
               <td>${((product.realTotalPriceCount)?c)!''}</td>
           <td class="tbl_btn">
                <a href="${basePath}manager/Goods_goodsInfo?goodsId=${(product.goodsId)?c}"><span class="review_single_model" style="    background: #00ad55;">查看</span></a>
                 
                </td>-->
              </tr>
  			</#list>
          </#if>
          </#if>
            </tbody>
          </table>
        </div>
    <!--翻页按钮-->
        
   <span>数量:</span><span>${(purchaseSaleOrderStatistics.outRealTotalQuantity)?c}件</span>
   <span>总结算:</span> <span>${(purchaseSaleOrderStatistics.realTotalPrice)?c}元</span> 
   <span>总生意额：</span>   <span>${(purchaseSaleOrderStatistics.outRealTotalPrice)?c}元</span> 
   
       
  	<#import "../../base/pager.ftl" as p>
   	<@p.pager pager = pager baseUrl = "manager/PurchaseSaleOrder_saleOrderStatisticsProductListPage" parameterMap={
   	"statisticsType":(requestVo.statisticsType)!'',"byOrderType":(requestVo.byOrderType)!'',"byOrderSortType":(requestVo.byOrderSortType)!'',
   	"barCode":(requestVo.barCode)!'',"goodsNumber":(requestVo.goodsNumber)!'',"outOrderNumber":(requestVo.outOrderNumber)!'',
   	"shopClerkId":(requestVo.shopClerkId?c)!'',"productSaleStatus":(requestVo.productSaleStatus?c)!'',"startTime":(requestVo.startTime)!'',
   	"endTime":(requestVo.endTime)!'',"firstGoodsCategoryId":(requestVo.firstGoodsCategoryId?c)!'',"secondGoodsCategoryId":(requestVo.secondGoodsCategoryId?c)!''  } /> 
</div> 

<script type="text/javascript">
$(function(){

	loadfirstGoodsCategoryList();
	function loadfirstGoodsCategoryList(){
		$.ajax({
			url : "${basePath}manager/GoodsCategory_goodsCategoryList",
			data : { 
				pageNumber:1,
				pageSize:100
			}, 
			dataType :"JSON",
			cache : false, 
			type : "POST",
			success : function(dat){
				if(dat.code==1){
					 var html ='';
					 html+='<option value="">----</option>';
					 $(dat.data).each(function(index,bean){
					 	if('${((requestVo.firstGoodsCategoryId?c)!'')}'==bean.id){
					 		html+='<option value="'+bean.id+'" selected = "selected">'+bean.categoryName+'</option> '; 
					 		loadSecondGoodsCategoryList(bean.id);
					 	}else{
					 		html+='<option value="'+bean.id+'">'+bean.categoryName+'</option> '; 
					 	}
					 	
					 });
					 $('#first_goods_category_list_select').html(html);
				} 
			}
		}); 
	}
	
	$('#first_goods_category_list_select').change(function(){
	 	var parentId=$('#first_goods_category_list_select').val();
	 	loadSecondGoodsCategoryList(parentId);
	 	
	 	var goodsCategoryId =$('#first_goods_category_list_select').find("option:selected").val();
	 	var goodsName=$('#first_goods_category_list_select').find("option:selected").text();
	 	if(goodsCategoryId==''){
	 		$('input[name=goodsName]').val('');
	 	}else{
	 		$('input[name=goodsName]').val(goodsName);
	 	}
	 	
	 	
	 });
	 
	 function loadSecondGoodsCategoryList(parentGoodsCategoryId){
		if('' == parentGoodsCategoryId){
			var html ='';
			html+='<option value="">----</option>';
			$('#second_goods_category_list_select').html(html);
			return ;
		}
	
		$.ajax({
			url : "${basePath}manager/GoodsCategory_goodsCategoryList",
			data : { 
				goodsCategoryParentId:parentGoodsCategoryId,
				pageNumber:1,
				pageSize:100
			}, 
			dataType :"JSON",
			cache : false, 
			type : "POST",
			success : function(dat){
				if(dat.code==1){
					 var html ='';
					 html+='<option value="">----</option>';
					 $(dat.data).each(function(index,bean){
					 	if('${((requestVo.secondGoodsCategoryId?c)!'')}'==bean.id){
					 		html+='<option value="'+bean.id+'" selected = "selected" >'+bean.categoryName+'</option>';
					 	}else{
					 		html+='<option value="'+bean.id+'">'+bean.categoryName+'</option> '; 
					 	}
					 });
					 $('#second_goods_category_list_select').html(html);
				} 
			}
		});
	}
	
	
	shopClerkList();
	function shopClerkList(){
		$.ajax({
			url : "${basePath}manager/ShopClerk_shopClerkList",
			data : { 
				pageNumber:1,
				pageSize:100
			}, 
			dataType :"JSON",
			cache : false, 
			type : "POST",
			success : function(dat){
				if(dat.code==1){
					 var html ='';
					 html+='<option value="">----</option>';
					 $(dat.data).each(function(index,bean){
					 	if('${((requestVo.shopClerkId?c)!'')}'==bean.id){
					 		html+='<option value="'+bean.id+'" selected = "selected">'+bean.jobNumber+':'+bean.clerkName+'</option>'; 
					 	}else{
					 		html+='<option value="'+bean.id+'" >'+bean.jobNumber+':'+bean.clerkName+'</option>'; 
					 	}
					 });
					 $('#shopClerkId_list').html(html);
				} 
			}
		}); 
	}
	
	
	
	

});

function click_barCode(barCode){
	$('#h2_goodsNumber').val('');
	$('#h2_shopClerkId').val('');
	$('#h2_barCode').val(barCode);
	$('#h2_form').submit(); 
}
function click_goodsNumber(goodsNumber){
	$('#h2_barCode').val('');
	$('#h2_shopClerkId').val('');
	$('#h2_goodsNumber').val(goodsNumber);
	$('#h2_form').submit(); 
}
function click_shopClerkId(shopClerkId){
	$('#h2_barCode').val('');
	$('#h2_goodsNumber').val('');
	$('#h2_shopClerkId').val(shopClerkId);
	$('#h2_form').submit(); 
}


function click_lookbarCode(barCode){
	$('#select_form input[name=barCode]').val(barCode);
	$('#select_form input[name=goodsNumber]').val('');
	$('#select_form').submit();	
}

function click_lookgoodsNumber(goodsNumber){
	$('#select_form input[name=barCode]').val('');
	$('#select_form input[name=goodsNumber]').val(goodsNumber);
	$("select[name=statisticsType]").find("option[value='1']").attr("selected",true);
	$('#select_form').submit();	
}

function clearbarCodeAndGoodsNumber(){
	 $('#select_form input[name=barCode]').val('');
	$('#select_form input[name=goodsNumber]').val('');
}

</script>
</body>
</html>

